//
//  MessageViewController.m
//  PigMarket
//
//  Created by mac on 2019/3/23.
//  Copyright © 2019 felix.pigmarket.oc. All rights reserved.
//

#import "MessageViewController.h"
#import "MessageCell.h"
//#import "OrderFormViewController.h"

@interface MessageViewController ()<UITableViewDelegate,UITableViewDataSource>

/**
 myTbaleView
 */
@property (nonatomic , strong) UITableView *myTableView;
/**
 dataArr
 */
@property (nonatomic , strong) NSArray *dataArr;
@end

@implementation MessageViewController


#pragma mark - view life cycle
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setUpView];
}

-(void)viewWillAppear:(BOOL)animated {
    [super viewWillAppear:animated];
}

-(void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
}

#pragma mark - init method
- (void)setUpView {
    [self initView];
    [self initLayout];
    [self initAction];
    [self initData];
}
- (void)initView {
    [self.view addSubview:self.myTableView];
}

- (void) initLayout {
    [self.myTableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(0);
    }];
}

- (void) initAction {
    
}

- (void)initData {
    self.dataArr = @[@{@"icon":@"message_basicoperation",@"messageNum":@"3",@"title":@"基础操作",@"detail":@"哈哈被带回家不到货时间订货会电视剧",@"time":@"2019-09-34"},
                     @{@"icon":@"message_orderform",@"messageNum":@"4",@"title":@"消费、订单",@"detail":@"",@"time":@"2090-09-09 20:30"},
                     @{@"icon":@"message_earning",@"messageNum":@"10",@"title":@"入账收入",@"detail":@"",@"time":@""},
                     @{@"icon":@"message_logistics",@"messageNum":@"100",@"title":@"物流配送",@"detail":@"",@"time":@""},
                     @{@"icon":@"message_system",@"messageNum":@"",@"title":@"系统内推",@"detail":@"",@"time":@""},
                     @{@"icon":@"message_remind",@"messageNum":@"",@"title":@"引导提醒",@"detail":@"",@"time":@""}];
}

#pragma mark - delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArr.count;
}



- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    MessageCell *cell = [MessageCell cellWithTableView:tableView];
    cell.infoDic = self.dataArr[indexPath.row];
    return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.row == 0) {//基础操作
        
    }else if (indexPath.row == 1) {//消费订单
        
    }else if (indexPath.row == 2) {//入账收入
        
    }else if (indexPath.row == 3) {//物流配送
        
    }else if (indexPath.row == 4) {//系统内推
        
    }else if (indexPath.row == 5) {//引导提醒
        
    }
}
#pragma mark - target action

#pragma mark - private method

#pragma mark - getter and setter
- (UITableView *)myTableView {
    if (!_myTableView) {
        _myTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
        _myTableView.rowHeight = 70;
        _myTableView.delegate = self;
        _myTableView.dataSource = self;
    }
    return _myTableView;
}
- (NSArray *)dataArr {
    if (!_dataArr) {
        _dataArr = [[NSArray alloc] init];
    }
    return _dataArr;
}

@end
